package com.googlecode.animator.view.timeline
{
	import flash.events.Event;
	
	public class GlobalMarker extends Marker
	{
		private var _id:String;
		private var _time:int;
		
		public static const GLOBAL_MARKER_UP:String = "globalMarkerUp";
		public static const GLOBAL_MARKER_MOVE:String = "globalMarkerMove";
		
		public function GlobalMarker(w:uint)
		{
			super(w);
			
			this.graphics.beginFill(0x000000);

			this.graphics.moveTo(0, 0);
			this.graphics.lineTo(w, 0);
			this.graphics.lineTo(w /2, w);
			
			addEventListener(SnapDraggableObject.OBJECT_UP, onGlobalMarkerUp);
			addEventListener(SnapDraggableObject.OBJECT_MOVE, onGlobalMarkerMove);
		}
		
		protected function onGlobalMarkerUp(e:Event):void
		{
			dispatchEvent(new Event(GLOBAL_MARKER_UP, true));
		}
		
		protected function onGlobalMarkerMove(e:Event):void
		{
			dispatchEvent(new Event(GLOBAL_MARKER_MOVE, true));
		}
		
		override public function cleanUp():void
		{
			super.cleanUp()

			removeEventListener(SnapDraggableObject.OBJECT_UP, onGlobalMarkerUp);
			removeEventListener(SnapDraggableObject.OBJECT_MOVE, onGlobalMarkerMove);
		}	
	}
}